字串小幫手 on linux


Posted by Rich on 2021-08-10

grep

grep 是把資料裡面有我們要的關鍵字那整行取下來。

  • grep 的幾個指令:
    • -a:將 binary 以 text 檔案的方式進行搜尋
    • -c:計算找到‘搜尋字串’的次數
    • -i:忽略大小寫差異
    • -n:輸出行號
    • -v:輸出沒有‘搜尋字串’的資料
    • --color=auto:幫文字上色

grep 'rich' 把有“rich"的行全部取下來。
grep -v 'rich' 把沒有“rich"的行全部取下來。
搭配正規表示法,才能真正發揮 grep 的實力。


#筆記







Related Posts

leetcode-Remove Duplicates from an Array (ES6)

leetcode-Remove Duplicates from an Array (ES6)

HTML訓導處|嵌入YouTube影片及各項設定

HTML訓導處|嵌入YouTube影片及各項設定

docker 是什麼:快速部署應用程式的實用工具

docker 是什麼:快速部署應用程式的實用工具


Comments